<?php
// test/unit/SimpleDocFlowTest.php
require_once dirname(__FILE__).'/../bootstrap/unit.php';
 
$t = new lime_test(9, new lime_output_color());

//$t->pass('This test always passes.');
 
$t->comment('::slugify()');
$t->is(SimpleDocFlow::slugify('LawDocument'), 'lawdocument', 
	'::slugify() converts all characters to lower case');

$t->is(SimpleDocFlow::slugify('law document num 123'), 'law-document-num-123', 
	'::slugify() replaces a white space by a -');

$t->is(SimpleDocFlow::slugify('law	document	num 123'), 'law-document-num-123',
	'::slugify() replaces several white spaces by a single -');

$t->is(SimpleDocFlow::slugify('law, manager document num 123'), 'law-manager-document-num-123',
	'::slugify() replaces non-ASCII characters by a -');

$t->is(SimpleDocFlow::slugify('  law'), 'law',
	'::slugify() removes spaces at the beginning of a string');

$t->is(SimpleDocFlow::slugify('law  '), 'law',
	'::slugify() removes spaces at the end of a string');

$t->is(SimpleDocFlow::slugify(''), 'n-a', 
	'::slugify() converts the empty string to \'n-a\'');

$t->is(SimpleDocFlow::slugify(' - '), 'n-a', 
	'::slugify() converts a string that contains only non-ASCII characters to \'n-a\'');

if (function_exists('iconv'))
	$t->is(SimpleDocFlow::slugify('Développeur Web'), 'developpeur-web', 
		'::slugify() removes accents');
else
	$t->skip('::slugify() removes accents - iconv not installed');